package cn.com.zhuxulin.android.demos.activities;

import android.app.Activity;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import cn.com.zhuxulin.android.demos.R;
import cn.com.zhuxulin.android.demos.bussiness.LocationInfo;
import cn.com.zhuxulin.android.demos.bussiness.MLocation;

public class LocationDemos extends Activity {
	private TextView result = null;
	private Location mLoca = null;
	private LocationListener LListener = null;
	private static String TAG = "LocationDemos";
	private String info = "";

	@Override
	protected void onStart() {
		super.onStart();

	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.location_demos);
		result = (TextView) findViewById(R.id.location);
		LListener = new LocationListener() {

			public void onLocationChanged(Location location) {
				info = new LocationInfo(mLoca).getInfo();
				result.setText(info);
				Log.e(TAG, info);
			}

			public void onProviderDisabled(String provider) {

			}

			public void onProviderEnabled(String provider) {

			}

			public void onStatusChanged(String provider, int status,
					Bundle extras) {
			}

		};
		mLoca = new MLocation(this, LListener).getLocationByNetWork();
		if (mLoca == null) {
			result.setText("info");
			return;
		}

	}
}